package operateur;

/**
 * Interface definition : GestionPaiement
 * 
 * @author OpenORB Compiler
 */
public abstract class GestionPaiementPOA extends org.omg.PortableServer.Servant
        implements GestionPaiementOperations, org.omg.CORBA.portable.InvokeHandler
{
    public GestionPaiement _this()
    {
        return GestionPaiementHelper.narrow(_this_object());
    }

    public GestionPaiement _this(org.omg.CORBA.ORB orb)
    {
        return GestionPaiementHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:operateur/GestionPaiement:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("crediterCpt")) {
                return _invoke_crediterCpt(_is, handler);
        } else if (opName.equals("creerCpt")) {
                return _invoke_creerCpt(_is, handler);
        } else if (opName.equals("debiterCpt")) {
                return _invoke_debiterCpt(_is, handler);
        } else if (opName.equals("getSolde")) {
                return _invoke_getSolde(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke_debiterCpt(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = operateur.identHelper.read(_is);
        float arg1_in = operateur.soldeHelper.read(_is);

        try
        {
            float _arg_result = debiterCpt(arg0_in, arg1_in);

            _output = handler.createReply();
            operateur.soldeHelper.write(_output,_arg_result);

        }
        catch (operateur.MontantNegatif _exception)
        {
            _output = handler.createExceptionReply();
            operateur.MontantNegatifHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_crediterCpt(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = operateur.identHelper.read(_is);
        float arg1_in = operateur.soldeHelper.read(_is);

        float _arg_result = crediterCpt(arg0_in, arg1_in);

        _output = handler.createReply();
        operateur.soldeHelper.write(_output,_arg_result);

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_creerCpt(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = operateur.identHelper.read(_is);
        String arg1_in = operateur.infoPaiementHelper.read(_is);
        float arg2_in = operateur.soldeHelper.read(_is);

        float _arg_result = creerCpt(arg0_in, arg1_in, arg2_in);

        _output = handler.createReply();
        operateur.soldeHelper.write(_output,_arg_result);

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_getSolde(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        String arg0_in = operateur.identHelper.read(_is);

        float _arg_result = getSolde(arg0_in);

        _output = handler.createReply();
        operateur.soldeHelper.write(_output,_arg_result);

        return _output;
    }

}
